<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/yoyoga.css" media="all"/>
    <script src="http://cdn.bootcss.com/jquery/1.12.3/jquery.min.js"></script>
    <script src="/layui/layui.js"></script>
</head>
<body>

<!-- head -->
<div class="layui-header">
    <ul class="layui-nav" style="background-color: #202020">
        <li class="layui-nav-item" style="width: 5%"></li>
        <li class="layui-nav-item" style="width: 13%" value="logo"><a href=""><img src="/image/yoyoga.png" style="height: 50px"></a></li>
        <li class="layui-nav-item" style="width: 12%"></li>
        <li class="layui-nav-item" style="text-align: center;width: 8%"><a href="">主页</a></li>
        <li class="layui-nav-item" style="text-align: center;width: 8%">
            <a href="#">介绍</a>
            <dl class="layui-nav-child">
                <dd><a href="#">瑜伽好处</a></dd>
                <dd><a href="#">瑜伽流派</a></dd>
            </dl>
        </li>
<!--        场馆-->
        <li class="layui-nav-item" style="text-align: center;width: 8%" id="gymIndex">
            <a href="#">场馆</a>
            <dl class="layui-nav-child">
                <dd><a href="#" onclick="toAllGym()">全部场馆</a></dd>
                <dd><a href="#" onclick="toMyGym()" id="signGymIndex">签约场馆</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item" style="text-align: center;width: 8%" id="trainerIndex">
            <a href="#">教练</a>
            <dl class="layui-nav-child">
                <dd><a href="#" onclick="toAllTrainer()">全部教练</a></dd>
                <dd><a href="#" onclick="toMytrainer()">我的教练</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item" style="text-align: center;width: 8%" id="studentIndex">
            <a href="#">学员</a>
            <dl class="layui-nav-child">
                <dd><a href="#" onclick="toMyStudent()">我的学员</a></dd>
            </dl>
        </li>

        <li class="layui-nav-item" style="text-align: center;width: 8%"><a href="">社区</a></li>

        <!--个人中心-->
        <li class="layui-nav-item" style="float: right" id="personCenter">
            <a href="#"><img src="//t.cn/RCzsdCq" class="layui-nav-img">我</a>
            <dl class="layui-nav-child">
                <dd><a href="#">个人主页</a></dd>
                <dd><a href="#">修改信息</a></dd>
                <dd><a href="#" onclick="toMyWallet()">我的钱包</a></dd>
                <dd><a href="#">我的好友</a></dd>
            </dl>
        </li>

        <li class="layui-nav-item" style="float: right" id="messageIndex">
            <a href="">消息<span class="layui-badge-dot"></span></a>
        </li>

        <li class="layui-nav-item" style="float: right" id="registerIndex">
            <a href="">注册</a>
        </li>
        <li class="layui-nav-item" style="float: right"><span style="color: #cccccc">|</span></li>
        <li class="layui-nav-item" style="float: right" id="loginIndex">
            <a href="">登陆</a>
        </li>

    </ul>
</div>

<!--body-->
<iframe id="iframeSetting" class="main-container" src="/html/gym.html"></iframe>



<script>
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;
    });
</script>

<script>
    function toAllGym() {
        $("#iframeSetting").attr({
            "src" : "/html/gym.html"
        })
    }

    function toAllTrainer() {
        $("#iframeSetting").attr({
            "src" : "/html/trainer.html"
        })
    }

    function toMytrainer() {
        $("#iframeSetting").attr({
            "src" : "/html/myTrainer.html"
        })
    }

    function  toMyWallet() {
        $("#iframeSetting").attr({
            "src" : "/user/toRechargePage"
        })
    }

    function   toMyStudent() {
        $("#iframeSetting").attr({
            "src" : "/html/myStudent.html"
        })
    }
    function toMyGym() {
        $("#iframeSetting").attr({
            "src" : "/html/myGym.html"
        })

    }

</script>

<script type="text/javascript" th:inline="javascript">
    var userType = [[${session.userType}]];
    //todo:头部选项的显示和隐藏

    $(function () {
        if(userType==null){ //未登陆状态,隐藏个人中心，教练、学员、消息
            $("#personCenter").hide();
            $("#gymIndex").hide();
            $("#studentIndex").hide();
            $("#messageIndex").hide();
        }
        if(usertype=='0'){
            //当前登录用户为学员:隐藏登陆、注册、签约场馆、学员
            $("#loginIndex").hide();
            $("#registerIndex").hide();
            $("#signGymIndex").hide();
            $("#studentIndex").hide();
        }
        if(usertype=='1'){
            //当前登录用户为教练:隐藏登陆、注册、教练
            $("#loginIndex").hide();
            $("#registerIndex").hide();
            $("#trainerIndex").hide();
        }
    });
    //如果是从支付宝跳转过来的，就跳转到我的钱包页。
    $(function () {
        var ref = document.referrer;
        if(ref!=null&&ref.indexOf("alipay")!=-1){
            toMyWallet();
        }
    });
</script>


</body>

</html>
